package com.test.demo;

import com.test.constant.MqttConstants;
import com.test.manager.AliMqttSendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ssang
 * @date 2022-02-11 16:06
 */
@Controller
public class MqttController {
    @Autowired
    AliMqttSendService aliMqttManager;

    @ResponseBody
    @RequestMapping("/test")
    public String test(String msg){
        //这个topic必须存在
        aliMqttManager.sendMqttMsg(MqttConstants.MQTT_QUEUE_TOPIC,MqttConstants.MQTT_QUEUE_TAG,msg);

        return "success";
    }
}
